﻿using GN.Pay.Client.Notify;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace GN.Pay.Client.Services
{
    /// <summary>
    /// 通知服务
    /// </summary>
    public interface INotifyService: IPayService
    {
        /// <summary>
        /// 创建付款通知
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns></returns>
        PayNotifyMessage CreatePayNotify(HttpRequestBase request);

        /// <summary>
        /// 创建付款通知
        /// </summary>
        /// <param name="requestDictionary">请求字典</param>
        /// <returns></returns>
        PayNotifyMessage CreatePayNotify(IDictionary<string, string> requestDictionary);

        /// <summary>
        /// 付款通知
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="response">响应</param>
        /// <param name="notifyCallback">通知回调</param>
        void PayNotifyHandle(HttpRequestBase request,
            HttpResponseBase response,
            Action<PayNotifyMessage> notifyCallback);

        /// <summary>
        /// 异步付款通知
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="response">响应</param>
        /// <param name="notifyCallback">通知回调</param>
        Task PayNotifyHandleAsync(HttpRequestBase request,
            HttpResponseBase response,
            Action<PayNotifyMessage> notifyCallback);

        /// <summary>
        /// 创建退款通知
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns></returns>
        RefundNotifyMessage CreateRefundNotify(HttpRequestBase request);

        /// <summary>
        /// 创建退款通知
        /// </summary>
        /// <param name="requestDictionary">请求字典</param>
        /// <returns></returns>
        RefundNotifyMessage CreateRefundNotify(IDictionary<string, string> requestDictionary);

        /// <summary>
        /// 退款通知
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="response">响应</param>
        /// <param name="notifyCallback">通知回调</param>
        void RefundNotifyHandle(HttpRequestBase request,
            HttpResponseBase response,
            Action<RefundNotifyMessage> notifyCallback);

        /// <summary>
        /// 异步退款通知
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="response">响应</param>
        /// <param name="notifyCallback">通知回调</param>
        Task RefundNotifyHandleAsync(HttpRequestBase request,
             HttpResponseBase response,
             Action<RefundNotifyMessage> notifyCallback);


        /// <summary>
        /// 创建转账通知
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns></returns>
        TransfersNotifyMessage CreateTransfersNotify(HttpRequestBase request);

        /// <summary>
        /// 创建转账通知
        /// </summary>
        /// <param name="requestDictionary">请求字典</param>
        /// <returns></returns>
        TransfersNotifyMessage CreateTransfersNotify(IDictionary<string, string> requestDictionary);

        /// <summary>
        /// 转账通知处理
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="response">响应</param>
        /// <param name="notifyCallback">通知回调</param>
        void TransfersNotifyHandle(HttpRequestBase request,
            HttpResponseBase response,
            Action<TransfersNotifyMessage> notifyCallback);

        /// <summary>
        /// 转账通知处理
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="response">响应</param>
        /// <param name="notifyCallback">通知回调</param>
        Task TransfersNotifyHandleAsync(HttpRequestBase request,
             HttpResponseBase response,
             Action<TransfersNotifyMessage> notifyCallback);
    }
}
